<template>
  <div class="my">
    <!-- <My @tologin="tologin">
      <p class="p2" slot="top">登录社区，体验更多功能</p>
      <p class="p3" @click="tologin" slot="top">账号/邮箱/手机登录&gt;</p>
    </My> -->
    <My>
      <div class="box" slot="top">
        <img :src="data.userpic" alt="">
        <div class="box1">
          <p class="p1">{{ data.username }}</p>
          <p class="p2"><span>总帖子{{ getCountsData.post_count }}</span>
            <span>今日发帖{{ getCountsData.today_posts_count }}</span>
          </p>
        </div>
      </div>
    </My>
  </div>
</template>

<script>
import My from '@/components/common/My.vue';
export default {
  components: { My },
  data() {
    return {
      data: {}
    }
  },
  methods: {
    tologin() {
      this.$router.push('/login')
    },
    init(){
      console.log(this.data,111);
      this.$http.get(`http://43.138.15.137:8085/api/user/getcounts/${this.data.id}`).then(res => {
        // console.log(res);
        this.getCountsData = res.data.data
        console.log(this.getCountsData);
      })
    }
  },
  created() {
    this.data = JSON.parse(localStorage.getItem('data'))
    console.log(this.data);
  }
}
</script>

